<template>
  <div class="all">
    <!-- 头部 -->
    <van-nav-bar title="标题" left-text="心理测试" left-arrow @click="goindex">
      <template #title>
        <van-search v-model="value" placeholder="请输入搜索关键词" />
      </template>
      <template #right>
        <div class="rightimg">
          <img src="../assets/img/imgdong/heartright.png" alt="" />
          <div>我的测评</div>
        </div>
      </template>
    </van-nav-bar>
    <!-- 轮播 -->
    <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
      <van-swipe-item
        ><img src="../assets/img/imgdong/banner.png" alt=""
      /></van-swipe-item>
    </van-swipe>
    <!-- 小图标 -->
    <!-- <van-grid
      :column-num="4"
      v-for="value in picdata"
      :key="value.text"
      :text="value.text"
    > -->
    <!-- <van-grid-item
        v-for="value in 8"
        :key="value"
        icon="photo-o"
        text="文字"
      /> -->
    <!-- <van-grid-item :icon="value.icon"></van-grid-item>
    </van-grid> -->
    <van-grid>
      <van-grid-item
        v-for="item in picdata"
        :icon="item.icon"
        :key="item.text"
        text="文字"
      />
    </van-grid>
    <!-- 用户信息 -->
    <div class="user">
      <img src="../assets/img/imgdong/zuoce.png" alt="" />
      <span class="span span1">用户彬**刚刚测试了</span>
      <span class="span span2">专业心理健康评估</span>
    </div>
    <!-- 每日推荐 -->
    <div class="recommand">
      <div class="title">
        <p>每日推荐</p>
        <span>一天一测，保持快乐</span>
      </div>
      <ul class="re-ul">
        <li>
          <div><img src="../assets/img/imgdong/tuijian.png" alt="" /></div>
          <p>专业心理健康测评</p>
          <span class="span3"
            ><img src="../assets/img/imgdong/xin.png" alt=""
          /></span>
          <span class="span4">339.7万人测过</span>
          <span class="span5">立即测试</span>
        </li>
        <li>
          <div><img src="../assets/img/imgdong/tuijian.png" alt="" /></div>
          <p>专业心理健康测评</p>
          <span class="span3"
            ><img src="../assets/img/imgdong/xin.png" alt=""
          /></span>
          <span class="span4">339.7万人测过</span>
          <span class="span5">立即测试</span>
        </li>
        <li>
          <div><img src="../assets/img/imgdong/tuijian.png" alt="" /></div>
          <p>专业心理健康测评</p>
          <span class="span3"
            ><img src="../assets/img/imgdong/xin.png" alt=""
          /></span>
          <span class="span4">339.7万人测过</span>
          <span class="span5">立即测试</span>
        </li>
        <li>
          <div><img src="../assets/img/imgdong/tuijian.png" alt="" /></div>
          <p>专业心理健康测评</p>
          <span class="span3"
            ><img src="../assets/img/imgdong/xin.png" alt=""
          /></span>
          <span class="span4">339.7万人测过</span>
          <span class="span5">立即测试</span>
        </li>
      </ul>
    </div>
    <!-- 换一换 -->
    <div class="change">换一换</div>
    <!-- 精选测试 -->
    <div class="select">
      <div class="title">
        <p>精选测试</p>
        <span>愿您在这里找到自我</span>
      </div>
      <div class="select-img">
        <img src="../assets/img/imgdong/jingxuanceshi.png" alt="" />
      </div>
      <!-- 详情列表 -->
      <ul class="select-ul">
        <li>
          <div><img src="../assets/img/imgdong/jingxuan1.png" alt="" /></div>
          <div class="select-right">
            <p class="p1">抑郁发生率评估（专业版）</p>
            <p class="p2">你是否拥有诱发抑郁的潜在因子？</p>
            <span class="span6"
              ><img src="../assets/img/imgdong/xin.png" alt=""
            /></span>
            <span class="span7">339.7万人测过</span>
            <span class="span8">立即测试</span>
          </div>
        </li>
      </ul>
    </div>
    <!-- 抑郁图 -->
    <div class="Depression">
      <img src="../assets/img/imgdong/yiyu.png" alt="" />
    </div>
    <!-- 在线测试 -->
    <ul class="text">
      <li>
        <div class="text-left">
          <p class="p3">SCL90自评量表在线测试</p>
          <p class="p4">你是否拥有诱发抑郁的潜在因子？</p>
          <span class="span9"
            ><img src="../assets/img/imgdong/xin.png" alt=""
          /></span>
          <span class="span10">256.5万人测过</span>
        </div>
        <div class="test-right">
          <img src="../assets/img/imgdong/jingxuan1.png" alt="" />
        </div>
      </li>
    </ul>
  </div>
</template>

<script>
import { useRouter } from "vue-router";
import { ref, reactive } from "vue";
export default {
  setup() {
    //  搜索框的数据
    const value = ref("");
    // 挨着轮播图的小图标
    const picdata = reactive([
      { icon: require("@/assets/img/imgdong/qinggan.png"), text: "情感" },
      { icon: require("@/assets/img/imgdong/renji.png"), text: "人际" },
      { icon: require("@/assets/img/imgdong/xingge.png"), text: "性格" },
      { icon: require("@/assets/img/imgdong/jiankang.png"), text: "健康" },
      { icon: require("@/assets/img/imgdong/qinzi.png"), text: "亲子" },
      { icon: require("@/assets/img/imgdong/nengli.png"), text: "能力" },
      { icon: require("@/assets/img/imgdong/zhiye.png"), text: "职业" },
      { icon: require("@/assets/img/imgdong/jingxuan.png"), text: "精选" },
    ]);
    // 返回首页
    const router = useRouter();
    const goindex = () => {
      router.push("/home/index");
    };
    return {
      // 搜索框
      value,
      // 小图标
      picdata,
      goindex,
    };
  },
};
</script>

<style lang="less" scoped>
.all {
  box-sizing: border-box;
  padding: 10px;
}
// 头部导航样式
.van-nav-bar {
  margin-top: 40.5px;
}
/deep/.van-icon-arrow-left:before {
  color: black;
  width: 22px;
  height: 22px;
  line-height: 22px;
  font-weight: 800;
}
/deep/.van-nav-bar__text {
  font-size: 17px;
  color: #353537;
  font-weight: 800;
}
// 搜索框样式
/deep/.van-search {
  width: 170px;
  height: 32px;
  border-radius: 17px;
  margin-left: 40px;
  background: #f7f7f7;
}
// 头部右侧样式
.rightimg {
  height: 32px;
  img {
    width: 22px;
    height: 22px;
  }
  div {
    line-height: 0;
    font-size: 9px;
  }
}
// 轮播图
.my-swipe .van-swipe-item {
  width: 331px;
  height: 140px;
  color: #fff;
  font-size: 20px;
  line-height: 150px;
  text-align: center;
  margin-top: 15.5px;
  // background-color: #39a9ed;
  img {
    width: 331px;
    height: 140px;
  }
}
// 用户信息
.user {
  margin-left: 26px;
  display: flex;
  align-items: center;
  font-size: 12px;
  margin-bottom: 23px;
  .span1 {
    color: #2a2a2a;
  }
  .span2 {
    color: #0498eb;
  }
}
// 每日推荐
.title {
  box-sizing: border-box;
  padding: 0 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  p {
    margin: 0;
    color: #1a1a1a;
    font-size: 17px;
    font-weight: 800;
  }
  span {
    color: #696969;
    font-size: 12px;
  }
}
// 每日推荐的简介
.re-ul {
  display: flex;
  flex-wrap: wrap;
  li {
    width: 172px;
    height: 150px;
    img {
      width: 172px;
      height: 84px;
    }
    p {
      color: #2d2d2d;
      font-size: 15px;
      margin: 0;
    }
    .span3 {
      img {
        width: 10px;
        height: 10px;
      }
    }
    .span4 {
      color: #5f5f5f;
      font-size: 11px;
      margin-right: 10px;
    }
    .span5 {
      color: #0793f2;
      font-size: 12px;
      width: 71px;
      height: 25px;
      display: inline-block;
      background: #e7f5fe;
      border-radius: 12.5px;
      line-height: 25px;
      text-align: center;
    }
  }
}
// 换一换
.change {
  color: #0197eb;
  font-size: 13px;
  text-align: center;
  height: 39.5px;
  line-height: 39.5px;
  background: #f5f5f5;
  border-radius: 5px;
}
// 精选测试
.select {
  width: 100%;
  .select-img {
    width: 349px;
    height: 134.5px;
    img {
      width: 100%;
      height: 100%;
    }
  }
}
.select-ul {
  box-sizing: border-box;
  padding: 0 18px;
  li {
    display: flex;
    align-items: center;
    img {
      width: 84px;
      height: 84px;
    }
    .select-right {
      margin-left: 20px;
      p {
        margin: 0;
      }
      .p1 {
        color: #2d2d2d;
        font-size: 17px;
      }
      .p2 {
        color: #989898;
        font-size: 13px;
      }
      .span6 {
        img {
          width: 7.65px;
          height: 9.4px;
        }
      }
      .span7 {
        color: #939393;
        font-size: 11px;
      }
      .span8 {
        display: inline-block;
        width: 71px;
        height: 25px;
        background: #e7f5fe;
        border-radius: 12.5px;
        color: #0793f2;
        font-size: 12px;
        margin-left: 20px;
        line-height: 25px;
        text-align: center;
      }
    }
  }
}
// 公共样式
// 立即测试
.test {
  display: inline-block;
  width: 71px;
  height: 25px;
  background: #e7f5fe;
  border-radius: 12.5px;
  color: #0793f2;
  font-size: 12px;
  margin-left: 20px;
  line-height: 25px;
  text-align: center;
}
// 抑郁
.Depression {
  height: 49px;
  margin: 10px auto;
  img {
    width: 100%;
    height: 100%;
  }
}
.text li {
  display: flex;
  align-items: center;
  .test-right {
    width: 84px;
    height: 84px;
    img {
      width: 100%;
      height: 100%;
    }
  }
  .text-left {
    margin-right: 80px;
    p {
      margin: 0;
    }
    .p3 {
      color: #2d2d2d;
      font-size: 17px;
    }
    .p4 {
      color: #989898;
      font-size: 13px;
    }
    .span9 {
      img {
        width: 7.65px;
        height: 9.4px;
      }
    }
    .span10 {
      color: #939393;
      font-size: 11px;
    }
  }
}
</style>
